$(function(){
	// 首页banner轮播
    bannerAuto("banner-container",0);
    bannerAuto("computer-container",3000);
    //首页服务选项卡
    $(".severBtn").each(function(i){
    	var index = i+1;
    	$(this).on("click",function(){
    		$(this).css({"borderBottom":"2px solid #1f8cd1"}).siblings().css({"borderBottom":"none"})
    		$(".severText-0"+index).show().siblings().hide();
    	});
    })
    $(".severBtn-02").one('click',function(){
        var dataShow = swiperShow("dataShow-container","arrow-left","arrow-right");
    })
    //咨询首页焦点图
    var newsBanner = bannerAuto("newsContainer",3000);
    // 通知公告轮播图
    var newsShow = swiperShow("newsShow","news-right","news-left",3);
    // 成果展示轮播图
    var resuleShow = swiperShow("resultContainer","result-right","result-left",4);
    //轮播图样式一(不带箭头按钮)
    function bannerAuto(sClass,sTime){
    	var swiper = new Swiper('.'+sClass, {
			pagination: '.swiper-pagination',
			paginationClickable: true,
	        loop:true,
	        autoplay: sTime
		});
    }

    /*    
     *    选项卡样式二(箭头轮播图)
     *    oClass轮播图类;   oLeft左箭头类;
     *    oRight右键头类;   oNum显示张数默认1;
     */
    function swiperShow(oClass,oPagination,oLeft,oRight,oNum){
            oNum = oNum || 1;
        var mySwiper = new Swiper('.'+oClass, {
                slidesPerView: oNum,
                loop:true,
                autoplay: 3000,
        });
        $('.'+oLeft).on('click', function(e){
            e.preventDefault()
            alert(mySwiper.activeIndex);
            mySwiper.swipePrev()
        })
        $('.'+oRight).on('click', function(e){
            e.preventDefault()
            mySwiper.swipeNext()
        })
    }
    // 遮罩登录框
    $(".loginLink").on("click",function(){
        $(".cover").show();
        $(".closeBtn").on("click",function(){
            $(".cover").hide();
        })
    })

})
//选项卡1(点击)
function clickTab(oBtn,oShow){
    $("."+oBtn).each(function(i){
        $(this).on("click",function(){
            $(this).addClass("active").siblings("."+oBtn).removeClass("active");
            $("."+oShow).eq(i).show().siblings("."+oShow).hide();
        })
    })
}
//选项卡2(滑过)
function hoverTab(oBtn,oShow){
    $("."+oBtn).each(function(i){
        $(this).hover(function(){
            $(this).addClass("active").siblings("."+oBtn).removeClass("active");
            $("."+oShow).eq(i).show().siblings("."+oShow).hide();
        });
    })
}